Memory controller, memory system, and memory control method

ABSTRACT

According to one embodiment, a memory controller includes a writing destination management unit which determines a writing destination of user data, an encoding unit which generates a parity of the user data, and an ECC management unit which measures a fatigue degree of each certain memory area of a nonvolatile memory, selects an encoding method to instruct the encoding unit to be performed according to the encoding method, and changes the encoding method to an encoding method having a high error correction capability in a case where the fatigue degree corresponding to the writing destination is equal to or higher than a threshold and a total sum of parities is equal to or less than a predetermined amount.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims the benefit of priority from U.S. Provisional Application No. 61/948,788, filed on Mar. 6, 2014; the entire contents of which are incorporated herein by reference.

FIELD

Embodiments described herein relate to a memory controller, a memory system, and a memory control method.

BACKGROUND

When user data stored in a memory is read out of the memory, the read-out user data may be different from the original value thereof. In order to handle such a problem, there is a typical method of encoding the user data for error correction, generating redundant data called parity, and storing a set of the user data and the parity in the memory. At the time of the occurrence of errors, the correction is performed using the parity data.

As the error correcting code, there are a BCH code, an RS (Reed Solomon) code and the like, for example. In recent years, a probability of errors occurring increases as the memory becomes miniaturized and multivalued, and thus a stronger error correcting code is requested. In order to improve an error correction capability, it is a general method to increase the data size of the parity. However, there are problems in such a method such as an increase in circuit scale necessary for the error correcting code, and a decrease in capacity of the user data to be stored (or, an increase in memory size).

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating an exemplary configuration of a memory device according to a first embodiment;

FIG. 2 is a diagram illustrating an example of improving an error correction capability by increasing the data size of parity;

FIG. 3 is a diagram illustrating an example of improving the error correction capability by dividing user data;

FIG. 4 is a diagram illustrating an example of switching a fatigue degree and the error correction capability of each memory chip;

FIG. 5 is a diagram illustrating an example of a system margin rate;

FIG. 6 is a diagram illustrating an example of WA;

FIG. 7 is a flowchart illustrating an example of a switching procedure of the error correction capability according to the first embodiment;

FIG. 8 is a block diagram illustrating an exemplary configuration of a memory device according to a second embodiment;

FIG. 9 is a diagram illustrating an example of a writing format which indicates writing management according to the second embodiment;

FIG. 10 is a diagram illustrating another example of a writing format which indicates the writing management according to the second embodiment;

FIG. 11 is a diagram illustrating an example of an address conversion table according to the second embodiment;

FIG. 12 is a flowchart illustrating an example of a writing procedure according to the second embodiment;

FIG. 13 is a diagram illustrating an example of a free block table;

FIG. 14 is a diagram illustrating an example of a read-out position management table;

FIG. 15 is a diagram illustrating an example of a logical-physical conversion table; and

FIG. 16 is a flowchart illustrating an example of a read-out procedure according to the second embodiment.

DETAILED DESCRIPTION

In general, according to one embodiment, there is provided a memory controller including a writing destination management unit configured to determine a writing destination of user data, an encoding unit configured to encode the user data to generate a parity, an ECC management unit configured to measure a fatigue degree of each certain memory area of a nonvolatile memory, to select an encoding among a plurality of encoding methods to be performed on the user data which is stored in a certain memory area, and to instruct the encoding unit to encode the user data according to the encoding method corresponding to the certain memory area which corresponds to the writing destination of the user data, and a writing control unit configured to make a control on the nonvolatile memory to write the user data at the writing destination determined by the writing destination management unit. The ECC management unit is configured to be provided with a memory controller to change the encoding method to an encoding method having a high error correction capability in a case where the fatigue degree of the certain memory area corresponding to the writing destination of the user data is equal to or higher than a threshold and a total sum of parities of the nonvolatile memory is equal to or less than a predetermined amount.

Exemplary embodiments of a memory controller, a memory system, and a memory control method will be explained below in detail with reference to the accompanying drawings. The present invention is not limited to the following embodiments.

First Embodiment

FIG. 1 is a block diagram illustrating an exemplary configuration of a memory device (a semiconductor memory device) according to a first embodiment. A semiconductor memory device 1 according to the embodiment includes a memory controller 2 and a nonvolatile memory 3. The semiconductor memory device 1 is configured to be connected to a host 4, which is illustrated in a state of being connected to the host 4 in FIG. 1. The host 4, for example, is an electronic apparatus such as a personal computer and a mobile terminal.

The nonvolatile memory 3 is a nonvolatile memory which stores data in a nonvolatile manner, for example, a NAND memory. Further, herein, the description will be made about an example using the NAND memory as the nonvolatile memory 3, but other memories except the NAND memory may be used. In the NAND memory, data is generally written or read out in data units of writing called pages.

The memory controller 2 controls writing to the nonvolatile memory 3 according to a write command from the host 4. In addition, the memory controller 2 controls reading out of the nonvolatile memory 3 according to a read-out command from the host 4. The memory controller 2 includes a host I/F 21, a memory I/F 22 (a memory control unit), a control unit 23, an ECC (Error Correcting Code) unit 24, a data buffer 27, an address conversion table storage unit 28, and an ECC management unit 29, all of which are connected to one another through an internal bus 20.

The host I/F 21 outputs a command received from the host 4, user data (write data), and the like to the internal bus 20. In addition, the host I/F 21 transmits the user data read out of the nonvolatile memory 3, a response from the control unit 23, and the like to the host 4.

The memory I/F 22 controls a process of writing the user data and the like to the nonvolatile memory 3 and a process of reading the data out of the nonvolatile memory 3 based on an instruction of the control unit 23.

The control unit 23 integrally controls the semiconductor memory device 1. The control unit 23, for example, is a CPU (Central Processing Unit), an MPU (Micro Processing Unit), or the like. When receiving a command from the host 4 through the host I/F 21, the control unit 23 makes a control according to the command. For example, the control unit 23 instructs the memory I/F 22 to write the user data and parity to the nonvolatile memory 3 according to the command from the host 4. In addition, the control unit 23 instructs the memory I/F 22 to read the user data and the parity out of the nonvolatile memory 3 according to the command from the host 4.

When receiving a write request from the host 4, the control unit 23 determines a storage area (a memory area) on the nonvolatile memory 3 for the user data to be accumulated in the data buffer 27. In other words, the control unit 23 has a function as a writing destination management unit which determines a writing destination of the user data. A correspondence relation between the logical address of the user data received from the host and the physical address indicating the storage area on the nonvolatile memory 3 stored with the user data is stored as an address conversion table in the address conversion table storage unit 28. The address conversion table may be configured to directly indicate the correspondence relation between the logical address and the physical address, or may be configured as a multistage table. The multistage table means a plurality of tables which are used for converting the logical address into an intermediate address once and then converting the intermediate address into the physical address.

When receiving a read-out request including the logical address from the host 4, the control unit 23 specifies the physical address corresponding to the logical address, and indicates the physical address to instruct the memory I/F 22 to read out the user data.

The ECC unit 24 includes an encoding unit 25 and a decoding unit 26. The encoding unit 25 encodes the user data stored in the data buffer 27 to generate the parity. The decoding unit 26 decodes the user data and the parity read out of the nonvolatile memory 3. The encoding of the embodiment will be described below in detail.

The data buffer 27 temporarily stores the user data received from the host 4 until the user data is stored in the nonvolatile memory 3, or temporarily stores the data read out of the nonvolatile memory 3 until the data is transmitted to the host 4. For example, the data buffer is configured by a general-purpose memory such as an SRAM (Static Random Access Memory) or a DRAM (Dynamic Random Access Memory). The address conversion table storage unit 28 stores the address conversion table.

The ECC management unit 29 selects an error correction capability based on a fatigue degree of the nonvolatile memory 3, and gives an instruction to the ECC unit 24. The operation of the ECC management unit 29 will be described below.

In this specification, memory cells commonly connected to a word line included in the nonvolatile memory 3 is defined as a memory cell group. In a case where the memory cell is a multi-level cell, the memory cell group corresponds to a plurality of pages. For example, in a case where a multi-level cell capable of storing two bits is used, the memory cell group corresponds to two pages. In this specification, writing to one page of the nonvolatile memory 3 means writing to one memory cell group in the case of a single-level cell, and writing to one page among the plurality of pages corresponding to one memory cell group in the case of the multi-level cell.

The nonvolatile memory 3 is configured by one or more memory chips. The memory chip is configured by a plurality of blocks (physical blocks). The block is configured by a plurality of memory cell groups.

Next, the error correction capability of the embodiment will be described. In this specification, the error correction capability is assumed to indicate correctable errors (the number of correctable bits) with respect to a certain amount of data. In the embodiment, the error correction capability is changed according to the fatigue degree of the nonvolatile memory 3. As a method of improving the error correction capability, the following two methods can be exemplified. The first one is a method of fixing the data size of the user data included in a code word and increasing the data size of the parity. FIG. 2 is a diagram illustrating an example of improving an error correction capability by increasing the data size of the parity. In the drawing, “Data” denotes the user data portion, and “ECC” denotes the parity portion. Further, the parity may be a parity for error correction, or may be configured by both the parity for error detection and the parity for error correction. ECC#1, ECC#2, and ECC#3 indicate encoding methods in which ECC#2 has an error correction capability higher than that of ECC#1, and ECC#3 has an error correction capability higher than that of ECC#2.

The second one is a method of fixing the data size of the parity included in a code word and dividing the user data. FIG. 3 is a diagram illustrating an example of improving the error correction capability by dividing the user data. In this way, by reducing the size of the user data to be subjected to the encoding for error correction while fixing the data size of the parity, it is possible to increase the error correction capability without increasing a circuit scale necessary for the encoding and decoding.

The above-described two methods are given as examples, and the example of improving the error correction capability is not limited to them. For example, there may be employed a method obtained by combining the above-mentioned two methods, so that the user data is divided and the data size of the parity is increased.

When the encoding is performed using a high error correction capability from the beginning, a possibility to fail the error correction becomes low, but a ratio of the parity to the user data becomes large. Therefore, in the embodiment, the encoding is performed according to an encoding method having a low error correction capability in an initial state where the nonvolatile memory 3 is less degraded. Then, in a case where the fatigue degree of the nonvolatile memory 3 is equal to or higher than a threshold, the encoding method is changed to that one having a high error correction capability. The fatigue degree of the nonvolatile memory 3 is not limited to be uniform in the nonvolatile memory 3. Therefore, it is possible to improve the error correction capability while suppressing an increase in total data size for the parity by changing the error encoding method, for example, in units of memory chips, blocks, pages, and the like of the nonvolatile memory 3 at the storage destination of the user data.

FIG. 4 is a diagram illustrating an example of switching a fatigue degree and the error correction capability of each memory chip. FIG. 4 illustrates a switching timing between the fatigue degree and the error correction capability for each memory chip in a case where a BER (Bit Error Rate) is used as a measure of the fatigue degree. In FIG. 4, the vertical axis represents the BER, and the horizontal axis represents a W/E (Write/Erase) frequency. The straight line in the middle of three straight lines showing the BER in the drawing shows an average BER of the whole nonvolatile memory 3. The uppermost straight line shows the BER of Chip#1 which is a memory chip steeply degraded more than the average BER, and the lowermost straight line shows the BER of Chip#2 which is a memory chip degraded less than the average BER. In this way, the degradation characteristic may be different depending on the memory chips, blocks, and the like.

For example, after the configuration is made for corresponding to the three encoding methods ECC#1, ECC#2, and ECC#3 as illustrated in FIGS. 2 and 3, the BER of each memory chip is calculated. The BER, for example, is calculated for each memory chip by counting the number of errors calculated at the time of decoding in the decoding unit 26. In the initial state, the user data to be stored in Chip#1 and Chip#2 is encoded in ECC#1. Then, in a case where the BER exceeds BER#1, the encoding method is switched to ECC#2; in a case where the BER exceeds BER#2, the encoding method is switched to ECC#3. When the W/E frequency becomes “a”, the encoding method of Chip#1 illustrated in FIG. 4 is switched to ECC#2; when the W/E frequency becomes “b” (a<b), the encoding method is switched to ECC#2. On the other hand, when the W/E frequency becomes “c” (c>b), the encoding method of Chip#2 is switched to ECC#1.

FIG. 5 is a diagram illustrating an example of a system margin rate. The system margin rate indicates a ratio of an ECC margin to a data margin in the system margin. Herein, the data margin is a margin used for a process of increasing a write capability (random write performance), or a process of extending a lifespan. The ECC margin is a margin used for the parity. The system margin indicates a difference between the memory capacity actually installed in the nonvolatile memory 3 and an advertised data capacity of the semiconductor memory device 1, or a value obtained by subtracting a certain amount from the difference.

FIG. 6 is a diagram illustrating an example of WA (Write Amplification). The WA is a ratio of the amount of data to be written in the nonvolatile memory 3 to the amount of writing data which is acquired from the host 4. FIG. 6 illustrates an aspect of a change in the WA in a case where the error correction capability is improved as the W/E frequency increases as illustrated in FIG. 5. The WA is low in the initial state, and increases as the ECC margin increases. When the WA exceeds the limit of maintaining the write capability, a rewriting frequency increases, the degradation of the memory cells progresses, and also the BER grows. For this reason, it is preferable that the error correction capability be increased in a range where the WA becomes equal to or less than the limit value. In the embodiment, the error correction capability is allowed to be improved in a range where the WA becomes equal to or less than the limit of maintaining the write capability. Further, the error correction capability is not allowed to be improved in a range where the WA exceeds the limit of maintaining the write capability. In this way, it is possible to improve the error correction capability while maintaining the write capability by setting the upper limit on the improvement of the error correction capability.

For example, the data margin corresponding to a case where the WA becomes the limit of maintaining the write capability is obtained as a limit for data capacity in advance, and a value obtained by subtracting the limit for the data capacity from the system margin is set as the upper limit of the ECC margin. Then, in a case where the total sum of parities in the whole nonvolatile memory 3 when the parities are calculated according to the encoding method set to each memory chip, block, or the like is equal to or lower than the upper limit of the ECC margin, the encoding method is allowed to be changed to make the error correction capability improved.

FIG. 7 is a flowchart illustrating an example of a switching procedure of the error correction capability according to the embodiment. The ECC management unit 29 performs the following process on each certain area (a certain memory area, for example, each memory chip, each block, each page, each ECC frame (code word), and the like) of the nonvolatile memory 3. As for timing of performing the following process, for example, the process may be performed on a writing destination at a time when the writing destination is determined in receiving a writing request from the host 4. At the other timings, the following process may be performed.

First, the ECC management unit 29 acquires the fatigue degree of a certain area of the nonvolatile memory 3 (step S1). As the fatigue degree, for example, the above-described BER can be used. Besides the BER, another index such as an error bit number in the ECC frame can be used as the fatigue degree.

Next, the ECC management unit 29 determines whether the fatigue degree is equal to or higher than a threshold (step S2). In a case where the fatigue degree is equal to or higher than the threshold (Yes in step S2), it is determined whether the WA is equal to or lower than the limit value (step S3). Herein, the determination of whether the WA is equal to or lower than the limit value can be made not by actually obtaining the WA but by, for example as described above, determining whether the total sum of parities in the whole nonvolatile memory 3 is equal to or lower than the upper limit of ECC margin.

In a case where the WA is equal to or lower than the limit value (Yes in step S3), the correction capability (the error correction capability) is switched (step S4), and the process ends. Specifically, the encoding method for the user data stored in a certain area of the nonvolatile memory 3 is switched to an encoding method having a higher error correction capability. For example, three types of encoding methods ECC#1, ECC#2, and ECC#3 having different error correction capabilities are prepared, in which the error correction capability increases in the order of ECC#1, ECC#2, and ECC#3. In this case, when the memory chip at the writing destination of the user data is assumed to be encoded by ECC#1 until then, the encoding method of the memory chip is switched to ECC#2 in step S4.

In a case where the fatigue degree is lower than the threshold (No in step S2) and the WA is higher than the limit value (No in step S3), the process ends without changing the correction capability.

As described above, in the embodiment, in a case where the fatigue degree of each certain area of the nonvolatile memory 3 becomes equal to or higher than the threshold, the encoding method is switched to improve the error correction capability in a range where the WA becomes equal to or lower than the limit of maintaining the write capability. Therefore, it is possible to improve the error correction capability while maintaining the write capability.

Second Embodiment

FIG. 8 is a block diagram illustrating an exemplary configuration of a memory device (a semiconductor memory device) according to a second embodiment. A semiconductor memory device 1 a of the embodiment includes a memory controller 2 a and the nonvolatile memory 3. The semiconductor memory device 1 a of the embodiment is the same as the semiconductor memory device 1 of the first embodiment except that the memory controller 2 of the first embodiment is replaced with the memory controller 2 a. In the memory controller 2 a of the embodiment, a writing destination management unit 30 is added to the memory controller 2 of the first embodiment. The components having the same function as that of the first embodiment will be denoted by the same reference numeral as the first embodiment, and the description thereof will not be repeated.

In the first embodiment, the description has been made about an example that the error correction capability is changed according to the fatigue degree. In addition, in the first embodiment, the control unit 23 has been described to have a function as the writing destination management unit which determines a writing destination of the user data while a method of managing the writing destination has not been specified. In the embodiment, the writing destination management unit 30 is provided, and an example of writing management will be described in which the change of the error correction capability according to the fatigue degree described in the first embodiment is realized.

Further, herein, the embodiment will be described such that the writing destination management unit 30 is configured to be provided separately from the control unit 23, but the control unit 23 may be configured to have a function as the writing destination management unit 30.

FIG. 9 is a diagram illustrating an example of a writing format which indicates the writing management according to the embodiment. FIG. 9 illustrates an example of changing the error correction capability by changing the data size of the parity as illustrated in FIG. 2 of the first embodiment. In the embodiment, a unit of memory areas of the nonvolatile memory 3 on which the writing can be simultaneously performed is referred to as a memory writing unit. The memory areas of the nonvolatile memory 3 on which the writing can be simultaneously performed may be one memory cell group (corresponding to one page) in the case of the single-level cell, or may be one memory cell group (corresponding to a plurality of pages) in the case of the multi-level cell. In addition, in a multi-plane type of nonvolatile memory 3 in which a plurality of blocks are allowed to be accessed in parallel, the memory area of the nonvolatile memory 3 on which the writing can be simultaneously performed may be a plurality of memory cell groups of the plurality of blocks which are allowed to be simultaneously accessed.

In the embodiment, the writing destination management unit 30 prepares a constant size of user data (hereinafter, refer to as a cluster), and determines a physical address corresponding to the logical address for each cluster. Then, the writing destination management unit 30 determines a writing destination such that the number of clusters in the memory writing unit becomes an integer. Referring to the example of FIG. 9, in the uppermost stage, the number of clusters in the memory writing unit is five; in the second stage, the number of clusters in the memory writing unit is four; and in the third stage, the number of clusters in the memory writing unit is three. Since the memory writing unit is fixed, the data size of the parity (“ECC” in the drawing) in the second stage is larger than that in the uppermost stage, and the data size of the parity in the third stage is larger than that in the second stage. Three types of formats illustrated in FIG. 9 correspond to the three types of error correction capabilities. In this case, all the three types of formats are configured to have the integer number of clusters in the memory writing unit.

FIG. 10 is a diagram illustrating another example of a writing format which indicates the writing management according to the embodiment. In the upper stage of FIG. 10, the number of clusters in the memory writing unit is five, and in the lower stage, the number of clusters in the memory writing unit is four. FIG. 10 illustrates an example of changing the error correction capability by dividing the user data as illustrated in FIG. 3 of the first embodiment. The writing destination management unit 30 determines the physical address corresponding to the logical address for each cluster similarly to the example of FIG. 9, and determines a writing destination such that the number of clusters in the memory writing unit becomes an integer. The cluster in the example of FIG. 10, however, becomes the user data forming one code word in a case where the error correction capability is lowest. In other words, a piece of user data (“Data”) in the upper stage of FIG. 10 is a cluster. In the lower stage of FIG. 10, the cluster is divided into two pieces as denoted by (1) and (2). Each of the clusters divided into two pieces is referred to as a division cluster. In the case of the lower stage, the code word is generated in units of division clusters when the encoding is performed. However, even in the case of the lower stage, the physical address corresponding to the logical address is determined for each cluster. In other words, the physical address is determined in a unit of cluster obtained by combining the two division clusters of (1) and (2). Then, a writing destination is determined such that the number of clusters (data obtained by combining the two division clusters) in the memory writing unit becomes an integer.

Further, herein, a minimum unit for determining the encoding method (the error correction capability) will be set as the memory writing unit in order to manage the number of clusters in the memory writing unit. In other words, for example, in a case where a plurality of blocks are allowed to be simultaneously accessed, the encoding method is determined in a unit of the plurality of blocks. However, even in a case where the plurality of blocks are allowed to be simultaneously accessed, the encoding method may be determined differently for each block. In this case, the number of clusters on one page of each block among the plurality of blocks to which the simultaneous access can be allowed is configured to be an integer.

FIG. 11 is a diagram illustrating an example of an address conversion table according to the embodiment. The address conversion table may directly show the correspondence relation between the logical address and the physical address as described in the first embodiment, or may show the correspondence relation between the logical address and the physical address in multiple stages. FIG. 11 illustrates an example of the direct correspondence relation between the logical address and the physical address. The upper stage of FIG. 11 illustrates an example of the address conversion table in a case where three clusters are included in the memory writing unit as exemplarily illustrated in FIG. 9. The lower stage of FIG. 11 illustrates an example of the address conversion table in a case where four clusters are included in the memory writing unit. One row of each table corresponds to a unit of determining the logical address, that is, one cluster.

In the example of FIG. 11, the physical address is configured by two numerals representing a first physical address and a second physical address. The first physical address indicates a physical address on the nonvolatile memory 3 of the memory writing unit. The second physical address indicates a position (offset) in the memory writing unit. For example, in a case where the memory writing unit is set to one page, the first physical address indicates the physical address in the page unit, and the second physical address indicates a position in the page. As illustrated in FIG. 11, in a case where three clusters are included in the memory writing unit, three entries in the address conversion table have the same first physical address. In a case where four clusters are included in the memory writing unit, four entries in the address conversion table have the same first physical address.

When receiving the writing request from the host 4, the writing destination management unit 30 divides the writing target user data in units of clusters and determines the physical address at the writing destination for each cluster. In the embodiment, since the encoding method may be differently set for each certain area of the nonvolatile memory 3, the number of clusters which can be written in each certain area may become different. Generally, in the memory device using the NAND memory, empty blocks (writable blocks) called free blocks are managed, and one of the free blocks is selected as the writing destination. The writing destination management unit 30 includes a writing data amount management unit 31. In the embodiment, the number of clusters which can be written in each certain area is different. Therefore, the writing data amount management unit 31 manages the number of clusters which can be written in the memory writing unit for each free block, and stores the number as a free block table. Then, the writing destination management unit 30 determines the writing destination for each cluster with reference to the free block table.

FIG. 12 is a flowchart illustrating an example of a writing procedure according to the embodiment. The example of FIG. 11 has illustrated that the address conversion table directly indicates the correspondence relation between the logical address and the physical address, but in many cases the correspondence relation between the logical address and the physical address is indicated in the multiple stages to reduce the data size of the address conversion table. FIG. 12 illustrates a writing procedure on an assumption of the example in which the correspondence relation between the logical address and the physical address is indicated in the multiple stages. Herein, the description will be made about an example of two-stage conversions, one from the logical address to a logical block address and the other from the logical block address to the physical address. The address conversion table to be used for the former conversion is set as a read-out position management table, and the address conversion table to be used for the latter conversion is set as a logical-physical conversion table. The word “logical block” is generally defined in various meanings, but in this specification the memory areas on the nonvolatile memory 3 gathered in a unit (a memory writing unit) of allowing the simultaneous access is called the logical block, and the logical block address is assumed as an address indicating the logical block and a page in the logical block. For example, in a case where M (M is an integer of 1 or higher) blocks are allowed to be simultaneously accessed, the logical block address indicates an address of M pages obtained by adding up the respective pages of the M blocks.

Further, as described above, in a case where the encoding method in units of M blocks allowed to be simultaneously accessed is determined, that is, a case where a certain area is set as the M blocks allowed to be simultaneously accessed as described in the first embodiment, the logical block address may include only the address indicating the logical block. In other words, the logical block address may not include the address indicating a page in the logical block. With such a configuration, the size of the free block table can be made small.

As illustrated in FIG. 12, when receiving the writing request from the host 4 (step S11), the writing destination management unit 30 determines a logical block at the writing destination with reference to the free block table (step S12). FIG. 13 is a diagram illustrating an example of the free block table. As illustrated in FIG. 13, the free block table shows the number of clusters (data storage amount) which can be written in the logical block corresponding to each logical block address. In addition, in a case where the encoding method in units of M blocks allowed to be simultaneously accessed is determined, the logical block address may include the address of the logical block (the address indicating a page in the logical block may not be included) as described above. In this case, the data storage amount corresponding to each logical block is assumed as a total amount of data which can be stored in the logical block. The writing destination management unit 30 selects the logical block from the top of the free block table as the writing destination, and the logical block selected as the writing destination is deleted from the free block table.

Next, the writing destination management unit 30 acquires the physical address corresponding to the logical block at the writing destination which is determined in step S12 with reference to the logical-physical conversion table which is stored in the address conversion table storage unit 28 in advance (step S13). Herein, it is assumed that the address conversion table storage unit 28 manages the correspondence relation between the logical address and the physical address in two stages of the read-out position management table and the logical-physical conversion table. FIG. 14 is a diagram illustrating an example of a read-out position management table. FIG. 15 is a diagram illustrating an example of a logical-physical conversion table. The logical-physical conversion table illustrated in FIG. 15 shows the correspondence relation between the logical block address and the physical address (the physical address on the nonvolatile memory 3). FIG. 15 illustrates a case where the simultaneous access can be allowed to two physical blocks as an example, in which one logical block address corresponds to addresses of two physical blocks. Further, the information corresponding to the offset illustrated in FIG. 11 is not shown in FIG. 14.

Next, the writing destination management unit 30 encodes the user data received from the host 4 and writes the data at the physical address acquired in step S13 (step S14). Specifically, the writing destination management unit 30 informs the ECC management unit 29 and the memory I/F 22 of the acquired physical address, and the ECC management unit 29 determines an encoding method for a certain area corresponding to the informed physical address through the process illustrated in FIG. 7. Then, the ECC management unit 29 instructs the encoding unit 25 to perform the encoding in accordance with the obtained encoding method. The encoding unit 25 performs the encoding based on the instruction. The memory I/F 22 makes a control on the nonvolatile memory 3 such that the code word (the user data and the parity) encoded by the encoding unit is written at the physical address instructed from the writing destination management unit 30. The ECC management unit 29 stores the determined encoding method as encoding information for each certain area.

Alternatively, the process illustrated in FIG. 7 may not be performed at the time of receiving the writing request. For example, while the process illustrated in FIG. 7 is performed periodically or the like, the encoding method for each certain area determined in the process may be stored as the encoding information. The logical-physical conversion table may be used as the encoding information. A column of the data storage amount is added in the logical-physical conversion table illustrated in FIG. 15. Then, the data storage amount of the logical-physical conversion table is updated based on the encoding method determined in the process illustrated in FIG. 7. With such a configuration, the encoding method can be identified with reference to the logical-physical conversion table. Alternatively, information for identifying the encoding method may be added in the logical-physical conversion table instead of the data storage amount. The ECC management unit 29 obtains the encoding method based on the data storage amount of the logical-physical conversion table at the time of the encoding, and instructs the encoding unit 25 to perform the encoding using the obtained encoding method.

Next, the writing destination management unit 30 updates the read-out position management table of the address conversion table storage unit 28 (step S14). As exemplarily illustrated in FIG. 14, the read-out position management table creates entries in each size (for example, 4 Kbyte) of the cluster over the range in which the logical address is acquired, and the logical address at which no writing has been performed is stored with “invalid” as the logocal block address. The writing destination management unit 30 updates the read-out position management table based on the writing destination for the writing performed in step S14.

Next, a read-out process of the embodiment will be described. FIG. 16 is a flowchart illustrating an example of a read-out procedure according to the embodiment. When receiving a read-out request from the host 4 (step S21), the control unit 23 obtains the logical block address corresponding to a read-out target logical address with reference to the read-out position management table of the address conversion table storage unit 28 (step S22). Next, the control unit 23 obtains the physical address corresponding to the logical block address with reference to the logical-physical conversion table of the address conversion table storage unit 28 (step S23). Then, the control unit 23 designates a physical address so as to instruct the memory I/F 22 to perform the reading from the nonvolatile memory 3, and the memory I/F 22 performs a control of reading data from the nonvolatile memory 3 (step S24).

The read-out user data and parity are decoded by the decoding unit 26. Specifically, the control unit 23 informs the ECC management unit 29 of the logical block address corresponding to the read-out target logical address, and the ECC management unit 29 obtains the corresponding encoding method based on the encoding information. Then, the ECC management unit 29 instructs the decoding unit 26 to perform the decoding in a decoding system corresponding to the encoding method.

As described above, in the embodiment, the writing destination of the nonvolatile memory 3 is determined for each cluster which is a certain size of the user data. Then, a plurality of encoding methods having different error correction capabilities are prepared, and the number of clusters in the memory writing unit is set to be an integer when the code word encoded according to each encoding method is written in the nonvolatile memory 3. Therefore, the logical address of the address conversion table is stored in units of clusters, and a case where the cluster size is set to be integer times the minimum unit of the logical address managed by the host 4, the table size can be made smaller than that in a case where the address conversion table is created in the minimum unit which is managed by the host. In addition, regardless of the encoding method, since one cluster is necessarily stored in an area which can be simultaneously read out, reading one cluster is performed by one reading operation. Therefore, it is possible to perform the reading fast regardless of the encoding method.

While certain embodiments have been described, these embodiments have been presented by way of example only, and are not intended to limit the scope of the inventions. Indeed, the novel embodiments described herein may be embodied in a variety of other forms; furthermore, various omissions, substitutions and changes in the form of the embodiments described herein may be made without departing from the spirit of the inventions. The accompanying claims and their equivalents are intended to cover such forms or modifications as would fall within the scope and spirit of the inventions. 

What is claimed is:
 1. A memory controller that controls a nonvolatile memory, the nonvolatile memory including a plurality of memory areas, comprising: a writing destination management unit configured to determine a writing destination of user data in the nonvolatile memory; an encoding unit configured to encode the user data to generate a parity, the encoding unit performing the encoding according to a plurality of encoding methods having different error correction capabilities, the plurality of encoding methods including a first encoding method and a second encoding method of which the error correction capability is higher than that of the first encoding method; an ECC management unit configured to measure a fatigue degree of each of the plurality of memory areas, to select an encoding method among the plurality of encoding methods to be performed on user data which is stored in a first memory area among the plurality of memory areas, and to instruct the encoding unit to encode the user data according to the encoding method corresponding to the first memory area, the first memory area corresponding to the writing destination of the user data; and a writing control unit configured to control the nonvolatile memory to write the user data at the writing destination determined by the writing destination management unit, wherein the ECC management unit changes the encoding method corresponding to the first memory area from the first encoding method to the second encoding method when the fatigue degree of the first memory area is equal to or higher than a threshold and a total sum of parities of the nonvolatile memory is equal to or less than a predetermined amount.
 2. The memory controller according to claim 1, further comprising a decoding unit configured to decode the user data and the parity which are read out of the nonvolatile memory, wherein the decoding unit detects the number of errors in the user data, and the number of errors in the user data is used as the fatigue degree.
 3. The memory controller according to claim 1, wherein each of the plurality of memory areas is a page.
 4. The memory controller according to claim 1, wherein each of the plurality of memory areas is a block.
 5. The memory controller according to claim 1, wherein each of the plurality of memory areas is a memory chip.
 6. The memory controller according to claim 1, wherein each of the plurality of memory areas is an area being simultaneously read out.
 7. The memory controller according to claim 1, wherein the nonvolatile memory is configured to be simultaneously written in a plurality of blocks, and be simultaneously read data out of the plurality of blocks, and each of the plurality of memory areas is the plurality of blocks.
 8. The memory controller according to claim 1, wherein a first size of parity is generated for the user data having a predetermined size when the encoding is performed according to the first encoding method, and a second size of parity larger than the first size is generated for the user data having the predetermined size when the encoding is performed according to the second encoding method.
 9. The memory controller according to claim 1, wherein a predetermined size of parity is generated for a first size of the user data when the encoding is performed according to the first encoding method, and the predetermined size of parity is generated for a second size of the user data smaller than the first size when the encoding is performed according to the second encoding method.
 10. The memory controller according to claim 1, wherein the writing destination management unit determines a writing destination in units of clusters of a certain size for the user data, and determines a writing destination of a code word configured by a cluster and parity corresponding to the cluster as a memory area of the nonvolatile memory which is simultaneously read out.
 11. The memory controller according to claim 9, wherein the number of code words, in each encoding method, which are stored in each of the plurality of memory areas being simultaneously read out is an integer.
 12. The memory controller according to claim 9, wherein the cluster is larger than a minimum unit of user data which is managed by a host.
 13. A memory system comprising: a nonvolatile memory configured to include a plurality of memory areas; a writing destination management unit configured to determine a writing destination of user data in the nonvolatile memory; an encoding unit configured to encode the user data to generate a parity, the encoding unit performing the encoding according to a plurality of encoding methods having different error correction capabilities, the plurality of encoding methods including a first encoding method and a second encoding method of which the error correction capability is higher than that of the first encoding method; an ECC management unit configured to measure a fatigue degree of each of the plurality of memory areas, to select an encoding method among the plurality of encoding methods to be performed on user data which is stored in a first memory area among the plurality of memory areas, and to instruct the encoding unit to encode the user data according to the encoding method corresponding to the first memory area, the first memory area corresponding to the writing destination of the user data; and a writing control unit configured to control the nonvolatile memory to write the user data at the writing destination determined by the writing destination management unit, wherein the ECC management unit changes the encoding method corresponding to the first memory area from the first encoding method to the second encoding method when the fatigue degree of the first memory area corresponding to the writing destination of the user data is equal to or higher than a threshold and a total sum of parities of the nonvolatile memory is equal to or less than a predetermined amount.
 14. A memory control method of controlling a nonvolatile memory, the nonvolatile memory including a plurality of memory areas, comprising: determining a writing destination of user data in the nonvolatile memory; encoding the user data using encoding unit to generate a parity, the encoding unit performing the encoding according to a plurality of encoding methods having different error correction capabilities, the plurality of encoding methods including a first encoding method and a second encoding method of which the error correction capability is higher than that of the first encoding method; measuring a fatigue degree of each of the plurality of memory areas, selecting an encoding among the plurality of encoding methods to be performed on user data which is stored in a first memory area among the plurality of memory areas, and encoding the user data according to the encoding method corresponding to the first memory area, the first memory area corresponding to the writing destination of the user data; writing the user data at the writing destination determined by the writing destination management unit; and changing an encoding method corresponding to the first memory area from the first encoding method to the second encoding method when the fatigue degree of the first memory area is equal to or higher than a threshold and a total sum of parities of the nonvolatile memory is equal to or less than a predetermined amount. 